const Router = require("@koa/router");
const router = new Router();
const {
  getStageInfo,
  getWasteInfo,
  getReceiveInfo,
  addStageInfo,
  addWasteInfo,
  updateStageInfo,
  addTransInfo,
  addHandle,
  getPackageTimeline,
  getWeightAbmormal,
  updateWasteInfo
} = require('../controller/process')

router.post("/getWasteInfo", async (ctx) => {
  ctx.body = await getWasteInfo(ctx.request.body)
});
router.post("/getStageInfo", async (ctx) => {
  ctx.body = await getStageInfo(ctx.request.body)
});
router.get("/getWeightAbmormal", async (ctx) => {
  ctx.body = await getWeightAbmormal()
});
router.post("/addStageInfo", async (ctx) => {
  ctx.body = await addStageInfo(ctx.request.body)
});
router.post("/addTransInfo", async (ctx) => {
  ctx.body = await addTransInfo(ctx.request.body)
});
router.post("/addHandle", async (ctx) => {
  ctx.body = await addHandle(ctx.request.body)
});
router.post("/getPackageTimeline", async (ctx) => {
  ctx.body = await getPackageTimeline(ctx.request.body)
});
router.post("/addWasteInfo", async (ctx) => {
  ctx.body = await addWasteInfo(ctx.request.body)
});
router.post("/getReceiveInfo", async (ctx) => {
  ctx.body = await getReceiveInfo(ctx.request.body)
});
router.post("/updateStageInfo/:id", async (ctx) => {
  ctx.body = await updateStageInfo(ctx.request.body, ctx.params.id)
});
router.post("/updateWasteInfo/:id", async (ctx) => {
  ctx.body = await updateWasteInfo(ctx.request.body, ctx.params.id)
});
module.exports = router;
